package Base;

import java.io.*;

/**
 * <p>Title FileTest</p>
 *
 * @author YiMing Liu
 * @date 2018/7/8 22:16
 * <p>Description:</p>
 */
public class FileTest {
    /*public static void main(String[] args) {
        File file = new File("F:\\");
        for (File thisFile : file.listFiles()){
            if(thisFile.isFile()){
                System.out.println(thisFile.toString());
            }
        }
    }*/

    /*public static void main(String[] args) {
        getFile(new File("F:\\迅雷"),"\t");

    }

    public static void getFile(File file, String s) {
        System.out.println(s + file.toString());
        File[] files = file.listFiles();
        if (files.length > 1) {
            for (int i = 0; i < files.length; i++) {
                if (files[i].isDirectory()) {

                    getFile(files[i], s + "\t");

                }
            }
        }

    }*/

    /*public static void main(String[] args) {
        File file = new File("F:\\456789456");
        if (file.isDirectory() || file.exists()) {
            System.out.println(file.toString());
        } else {
            file.mkdir();
            System.out.println("文件不存在，创建成功！！");
        }
    }*/

    public static void main(String[] args) {
        String read;
        String encoding;
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(new File("F:\\1.txt")),"GB2312"));
            while ((read=in.readLine())!=null){
                System.out.println(read);
            }
            in.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
